-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open RouteController to custom location snapping #85
Open RouteController to custom location snapping #85
Conversation
@@ -230,7 +230,13 @@ open class RouteController: NSObject, Router { | |||
- important: If the rawLocation is outside of the route snapping tolerances, this value is nil. | |||
*/ | |||
var snappedLocation: CLLocation? { | |||
self.rawLocation?.snapped(to: self.routeProgress.currentLegProgress) | |||
let snappedDefault = self.rawLocation?.snapped(to: self.routeProgress.currentLegProgress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you doing duplicated work here? If there is a delegate, the delegate should do the snapping, otherwise the default snapping happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the nice PR, I think this will be helpful in using the library. Could you double check that we don't have to snap the location twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 - could you add a changelog entry for your changes?
Sure thing 👍 |
Description
This PR opens the
RouteController.snappedLocation
to be additionally modified by delegate implementers.This is useful to plug in a custom snapping logic.
Infos for Reviewer
The intention was to open up the snapping logic but make it optional and don't change snapping behavior if custom logic is not provided. If custom snapping doesn't provide a valid value (ie. fails), the default snapping shall be used as fallback.